package com.aurora.app.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.aurora.base.util.QrCodeUtil;
import com.google.zxing.WriterException;

@Controller
@RequestMapping(value = "test")
public class testController {
	@RequestMapping(value = "/qr")
	public void qr(HttpServletRequest request, HttpServletResponse response)
			throws IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		String website = request.getParameter("website");
		try {
			QrCodeUtil.genGR(website, response.getOutputStream());
		} catch (WriterException e) {
			e.printStackTrace();
		}
	}
	
	@RequestMapping(value = "/qrshow")
	public ModelAndView qrshow(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView mv = new ModelAndView("test/qr");
		return mv;
	}
	
	@RequestMapping(value = "/showmap")
	public ModelAndView showmap(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView mv = new ModelAndView("test/map");
		return mv;
	}
	
}
